import java.util.ArrayList;
import java.util.Collections;

public class bublesort {
	public static void main(String[] args) {
				int num = 10;
				ArrayList<Integer> list = new ArrayList<Integer>(10);
				for (int i=0;i<10;i++) {
					list.add(i);
				}
				Collections.shuffle(list);
				System.out.println(list);
				System.out.println(list.get(0));
				long time1, time2;
				time1 = System.nanoTime();
				boolean flag = false;
				for(int i=0; i<num-1 && !flag; i++) {
					for(int j=0; j<num-i-1; j++) {
						if (list.get(j) > list.get(j+1)) {
							int tmp = list.get(j);     // tmp = a[j]
							list.set(j,list.get(j+1)); // a[j] = a[j+1]
							list.set(j+1,tmp);     // a[j+1] = tmp
						}
						System.out.println(i+","+j+list);
					}
				}
				time2 = System.nanoTime();
				double second = (double) (time2-time1)/1000000000.0;
				System.out.println(second);
			}
		}
